<template>
  <div class="c-bg-sgray c-pb20">
    <div class="c-fs20 c-fs30 c-textAlign-c c-bg-white c-ph24 c-pv36 c-lh c-text-ellipsis1">{{homeWorkInfo.name}}</div>
    <div class="c-bg-white c-mt10 c-pb10" v-if="homeWorkInfo.description && homeWorkInfo.description.length > 0 && (homeWorkInfo.cover != '' || (homeWorkInfo.description.length == 1 ? homeWorkInfo.description[0].content != '' : true))||homeWorkInfo.cover">
      <div class="c-text-hidden">
        <img class="c-w100" :class="cfg.isCopyPicture == 0 ? 'imgCloseBig' : ''" :src="$addXossFilter(homeWorkInfo.cover)" alt="" />
      </div>

      <clock-course-detail-com class="c-pb30" v-if="homeWorkInfo.description && homeWorkInfo.description.length > 0 && (homeWorkInfo.cover != '' || (homeWorkInfo.description.length == 1 ? homeWorkInfo.description[0].content != '' : true))" :status='0' :description='homeWorkInfo.description' @clickShowDesc='clickShowDesc' @clickShowVideo='clickShowVideo'></clock-course-detail-com>
    </div>
    <div class="c-hh60 c-aligni-center c-ph24 c-flex-row">
      <i v-if="homeWorkInfo.targetTip&&workType==3" @click="clickShowCondition" class="iconfont c-fc-gray c-fs20">&#xe69d;</i>
      <span v-if="workType==3" @click="clickShowCondition" class="c-fs20 c-flex-grow1 c-w0 c-pl10">{{homeWorkInfo.targetTip ? '通关条件' : ''}}</span>
      <i class="iconfont c-fs20">&#xea41;</i>
      <span class="c-fs20 c-pl10">{{testTime}}</span>
    </div>
    <div class="c-mh24 c-bg-white c-br20 c-pt26">
      <!-- 题目 -->
      <div class="c-fs24 c-ph20 c-wb-ba">
        <span class="fl c-lh30">{{curNum}}.【{{typeQueMap[queInfo.type]}}】</span>
        <span class="c-lh30" :class="[cfg.isCopyPicture == 0 ? 'closeBig' : 'aCloseBig', cfg.isCopy == 0 ? 'copyNot' : '']" v-html="queInfo.problem"></span>
      </div>
      <!-- 选项 -->
      <template v-if="queInfo.type != 5">
        <div @click="clickChooseOption(item.option)" :class="index == queInfo.optionArr.length - 1 ? 'c-pb36':''" class="c-pt30 c-ph20 c-flex-row c-fs24" v-for="(item,index) in queInfo.optionArr" :key="index">
          <div class="c-ww36 c-hh36 c-brp50 c-flex-row c-flex-center" :class="resultAswList.indexOf(item.option) > -1 ? 'theme-bg c-fc-white':'c-bg-mgray'">{{item.option}}</div>
          <div class="c-flex-grow1 c-lh36 c-w0 c-pl20 c-wb-ba" :class="[cfg.isCopyPicture == 0 ? 'closeBig' : 'aCloseBig', cfg.isCopy == 0 ? 'copyNot' : '']" v-html="item.answer"></div>
        </div>
      </template>
      <template v-else>
        <div :class="index == queInfo.optionArr.length - 1 ? 'c-pb36':''" class="c-pt30 c-ph20 c-flex-row c-fs24" v-for="(item,index) in queInfo.optionArr" :key="index">
          <div class="c-ww36 c-hh36 c-brp50 c-flex-row c-flex-center" :class="resultAswList.indexOf(item.option) > -1 ? 'theme-bg c-fc-white':'c-bg-mgray'">{{index * 1 + 1}}</div>
          <div class="c-flex-grow1 c-lh36 c-w0 c-ml20 c-wb-ba c-bd-b1-mgray">
            <input type="text" class="input-answer c-w100 c-fs28 c-fc-xblack c-bd0" >
          </div>
        </div>
      </template>

      <div v-if="!queInfo.nextNum && queInfo.isNeedTutor != -1 && !isRevise" class="c-hh120 c-ph20 c-flex-row c-aligni-center c-bd-t1">
        <span v-show="queInfo.isNeedTutor" class="c-fc-red c-fs20">*</span>
        <span class="c-pr24 c-fs20" @click="showTip">监护人电话 <span class="iconfont c-fs20 c-fc-sgray c-ml12">&#xe8e8;</span></span>
        <input type="tel" @focus='inputFocus' @blur='inputBlur' v-model="tutorPhone" class="input-reset c-w0 c-fs24 c-flex-grow1 c-hh64 c-ph24">
      </div>
      <div v-if="!queInfo.nextNum && isDisCheat==2 && !isRevise" class="c-bg-white c-flex-row c-justify-sb c-ph20 c-aligni-center" :class="!queInfo.nextNum && queInfo.isNeedTutor != -1 && !isRevise?'c-pb24':'c-bd-t1 c-pv24'">
        <div class="c-fs20 c-fc-xblack">打卡可见范围</div>
        <div class="c-fs20 c-fc-gray c-flex-row ">
          <div class="c-bd1-mgray c-pv6 c-ph18 c-mr24 c-br20 c-fw600" :class="enableShow==1?'theme-bd1 theme-bg-10 theme-fc':''" @click="enableShowAll">所有人</div>
          <div class="c-bd1-mgray c-pv6 c-ph18 c-br24 c-fw600" :class="enableShow==0?'theme-bd1 theme-bg-10 theme-fc':''" @click="enableShowOne">仅老师</div>
        </div>
      </div>
      <div class="c-hh70 c-flex-row c-flex-center c-fs26 c-bd-t1">
        <span @click="clickPreQue" class="c-hh70  c-flex-grow1 c-w0 c-flex-row c-flex-center c-br-bl20" :class="queInfo.beforeNum ? '':'c-fc-gray'">上一题</span>
        <span v-if="queInfo.nextNum" @click="clickNextQue" class="c-hh70  c-flex-grow1 c-w0 c-flex-row c-flex-center theme-bg c-fc-white c-br-br20">下一题</span>
        <span v-else @click="clickSubmit" class="c-hh70  c-flex-grow1 c-w0 c-flex-row c-flex-center theme-bg c-fc-white c-br-br20">确认提交</span>
      </div>
    </div>

    <!-- 视频播放器 -->
    <video-popup :showVideo="showVideo" @clickCloseVideo="clickCloseVideo" :videoSrc="currentVideoObj.videoSrc" :m3u8Url="currentVideoObj.m3u8Url"></video-popup>

  </div>
</template>

<script>
import { utilJs } from "@/utils/common.js";
import ClockCourseDetailCom from "@/components/templates/clockIn/clockCourseDetailCom.vue";
import videoPopup from "@/components/templates/common/videoPopup.vue";
//const clientW = document.documentElement.clientWidth > 640 ? 640 : document.documentElement.clientWidth; //屏幕宽度
//const videoH = clientW / 320 * 180; //视频高度
let curHwId = ''; //当前作业ID
let isReText = 0; //是否重测
let myRetextAswerList = []; //重测答案
let inputScrollTop = 0;
let testTimeCon = null;
let testTimeTmp = 0;
let isClicking = false;
let examMainId = ""; //当前考试ID
export default {
  name: "ChoiceQue",
  components: {
    ClockCourseDetailCom,
    videoPopup
  },
  props: [],
  beforeRouteLeave(to, from, next) {
    //当有评论弹窗的时候，后退就关闭弹窗,因为后退会把history历史栈后退一个，所以要添加回去
    if (this.showVideo) {
      this.showVideo = false;
      history.pushState(null, null, `${window.location.href.split("#")[0]}#${from.fullPath}`);
    } else {
      next();
    }
  },
  data() {
    return {
      theme: localStorage.getItem("colorName") ? localStorage.getItem("colorName") : "mb5_default",
      typeQueMap: {
        1: '单选题',
        2: '多选题',
        4: '判断题',
        5: '填空题',
      },
      answerText: '',
      showDesc: false,
      showVideo: false,
      homeWorkInfo: {},
      resultAswList: [], //回答内容
      curNum: 1,
      tutorPhone: '', //监护人电话
      queInfo: {},
      testTime: '', //测试时间
      isRevise: false, //是否订正
      realReviseNum: -1, //是否订正
      isFromWrong: false,
      ttId: '', //营期ID
      tpId: '', //环节ID
      tlId: '', //课时ID
      questionId: '', //上一题的题目id
      workType:'',
      clockInId:'',
      currentVideoObj: {},
      cfg: JSON.parse(localStorage.getItem("cfg")),
      enableShow:1,
      isDisCheat:0
    };
  },
  created() {
    utilJs.appShare(this);
  },
  methods: {
    enableShowAll() {
      this.enableShow = 1
    },
    enableShowOne() {
      this.enableShow = 0
    },
    getBaseConfig() {
      let postUrl = `${global.apiurl}signCard/getBaseConfig?signColId=${this.clockInId}`;
      utilJs.getMethod(postUrl, (res) => {
        this.isDisCheat = res.isDisCheat
      });
    },
    showTip() {
      let textMessage = '1、监护人电话不能填写打卡本人的电话<br/>2、监护人电话必须是进入过该公众号平台的手机号，如果填写的手机号提示：手机号填写有误，平台下未存在该用户，则需要用该手机号微信进入该公众号平台绑定后输入才有效。'
      this.$cjConfirm({
        title: '监护人电话要求', //
        titleCenter: true, //标题是否居中
        message: textMessage,
        messageCenter: false, //内容是否居中
        showMasker: true, //是否显示透明背景
        clickCloseModal: false, //是否点击透明背景关闭弹窗
        showCancelButton: false, //是否显示取消按钮
        cancelButtonText: '', //取消按钮文本
        confirmButtonText: '好的', //确认按钮文本
        color:'',
        onConfirm() {
        },
      })
    },
    //IOS微信6.7以上版本会导致输入法收起的时候，键盘没收起，需要手动滚下屏幕
    inputFocus() {
      if (navigator.userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/)) {
        inputScrollTop = document.documentElement.scrollTop || document.body.scrollTop;
      }
    },
    inputBlur() {
      if (navigator.userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/)) {
        setTimeout(() => {
          document.body.scrollTop = inputScrollTop - 1 || 0;
        });
      }
    },
    clickShowCondition() {
      this.$cjConfirm({
        message: this.homeWorkInfo.targetTip,
        showCancelButton: false,
        clickCloseModal: true
      })
    },
    //点击上一题
    clickPreQue() {
      if (this.queInfo.beforeNum) {
        this.curNum = this.queInfo.beforeNum;
        this.resultAswList = [];
        this.getChooseDatail();
      }
    },
    //点击下一题
    clickNextQue() {
      if (this.queInfo.nextNum) {
        if (this.queInfo.type != 5 && this.resultAswList.length == 0) {
          this.$showCjToast({
            text: '请选择答案',
            type: 'warn',
            time: 1500
          });
          return;
        }
        if (this.queInfo.type == 5) {
          let answerInputArr = [];
          let inputDomArr = document.querySelectorAll('.input-answer');
          for (let item of inputDomArr) {
            item.value && answerInputArr.push(item.value);
          }
          if (inputDomArr.length != answerInputArr.length) {
            this.$showCjToast({
              text: '请输入填空内容',
              type: 'warn',
              time: 1500
            });
            return;
          }
          this.resultAswList = [];
          this.resultAswList.push(JSON.stringify(answerInputArr));
        }
        this.$loading.show();
        if (isReText) {
          //重测的话点击下一题要记录每次的答案
          let myRetextAswer = {
            questionId: this.queInfo.questionId,
            userAnswer: this.resultAswList.join('')
          };
          let answerIndex = myRetextAswerList.findIndex(item => {
            return item.questionId == this.queInfo.questionId;
          });
          if (answerIndex > -1) {
            myRetextAswerList[answerIndex] = myRetextAswer;
          } else {
            myRetextAswerList.push(myRetextAswer);
          }
          this.curNum = this.queInfo.nextNum;
          if (this.queInfo.type == 5) {
            let inputDomArr = document.querySelectorAll('.input-answer');
            for (let item of inputDomArr) {
              item.value = '';
            }
          }
          this.getChooseDatail();
          return;
        }

        this.saveCurAswer(0).then(res => {
          this.curNum = this.queInfo.nextNum;
          this.resultAswList = [];
          if (this.queInfo.type == 5) {
            let inputDomArr = document.querySelectorAll('.input-answer');
            for (let item of inputDomArr) {
              item.value = '';
            }
          }
          this.getChooseDatail();
        })
      }
    },

    clickShowDesc(isShow) {
      this.showDesc = isShow;
    },

    //点击显示视频
    clickShowVideo(videoSrc, m3u8Url) {
      this.showVideo = true;
      this.currentVideoObj = {videoSrc, m3u8Url}
    },
    //点击关闭视频
    clickCloseVideo() {
      if (this.showVideo) {
        this.showVideo = false;
      }
    },

    //保存当前题目的答案
    saveCurAswer(isFinished) {
      let that = this;
      if (isClicking) {
        return;
      }
      isClicking = true;
      return new Promise((resolve, reject) => {
        let data = {
          isFinished: isFinished,
          tutor: this.tutorPhone,
          useTime: this.testTime,
          isRevise: this.isRevise,
          examMainId: this.queInfo.examMainId,
          questionId: this.queInfo.questionId,
          enableShow: this.enableShow,
          userAnswer: utilJs.checkScriptStr(this.resultAswList.join(''))
        }
        utilJs.postMethod(`${global.apiurl}signCard/saveUserAnswer`, data, res => {
          isClicking = false;
          if (that.isRevise) {
            that.$showCjToast({
              text: res.result ? '答案正确' : '答案错误',
              type: 'success',
            });
          }
          resolve(res);
        }, failRes => {
          isClicking = false;
          reject(failRes);
        });
      });
    },

    //保存重测的题目
    saveReTextAswer() {
      if (isClicking) {
        return;
      }
      isClicking = true;
      return new Promise((resolve, reject) => {
        let data = {
          tutor: this.tutorPhone,
          useTime: this.testTime,
          examMainId: this.queInfo.examMainId,
          examInfoArr: myRetextAswerList,
          enableShow: this.enableShow,
        };
        utilJs.postMethod(`${global.apiurl}signCard/resurvey`, data, res => {
          isClicking = false;
          resolve(res);
        }, failRes => {
          isClicking = false;
          reject(failRes);
        });
      });
    },

    //点击提交
    clickSubmit() {
      if (this.queInfo.type == 5) {
        let answerInputArr = [];
        let inputDomArr = document.querySelectorAll('.input-answer');
        for (let item of inputDomArr) {
          item.value && answerInputArr.push(item.value);
        }
        if (inputDomArr.length != answerInputArr.length) {
          this.$showCjToast({
            text: '请输入填空内容',
            type: 'warn',
            time: 1500
          });
          return;
        }
        this.resultAswList = [];
        this.resultAswList.push(JSON.stringify(answerInputArr));
      }
      if (this.resultAswList.length == 0) {
        this.$showCjToast({
          text: '请选择答案',
          type: 'warn',
          time: 1500
        });
        return;
      } else if (this.queInfo.isNeedTutor == 1 && !this.tutorPhone && !this.isRevise) {
        this.$showCjToast({
          text: '请输入监护人手机号',
          type: 'warn',
          time: 1500
        });
        return;
      } else if (this.queInfo.isNeedTutor != -1 && this.tutorPhone && !this.isRevise && this.tutorPhone == localStorage.getItem('uMobile')) {
        this.$showCjToast({
          text: "监护人手机号不能是自己的",
          type: "warn",
          time: 1000,
        });
        return;
      }
      if (this.ckFrom == global.ckFrom.camp) {
        localStorage.setItem(`camp${this.tlId}`, 100);
        // 记录播放进度
        let data = {
          ttId: this.ttId, //营期ID
          tpId: this.tpId, //环节ID
          tlId: this.tlId, //课时ID
          ratio: 100, //完成进度0-100
        }
        utilJs.postMethod(global.apiurl + 'k12/trainings/progress', data, function (res) { });
      }
      //重测
      if (isReText) {
        let myRetextAswer = {
          questionId: this.queInfo.questionId,
          userAnswer: this.resultAswList.join('')
        };
        myRetextAswerList.push(myRetextAswer);
        this.saveReTextAswer().then(res => {
          this.$store.commit('updateClockReTextResult', Math.floor(res.accuracy * 100));
          this.$routerGo(this, "replace", {
            path: "/homePage/clockIn/homeWorkResult",
            query: {
              examMainId: this.queInfo.examMainId,
              isFromWrong: this.isFromWrong,
              realReviseNum: this.realReviseNum,
              curDate: this.curDate,
              workType:this.workType,
              clockInId:this.clockInId,
              curHwId: curHwId,
            }
          });
        });
        return;
      }

      this.saveCurAswer(1).then(res => {
        if (this.isRevise && res.resultExamDetails) {
          let rightNum = res.resultExamDetails.filter(item => {
            return item.isRight == 1;
          }).length;
          this.$store.commit('updateClockWrongRightNumber', rightNum);
          if (this.isRevise) {
            this.realReviseNum = res.realReviseNum; //当前订正对的题目数
          }
        }
        this.isFromWrong && window.localStorage.setItem('homeWorkResultArr', JSON.stringify(res.resultExamDetails));
        this.$routerGo(this, "replace", {
          path: "/homePage/clockIn/homeWorkResult",
          query: {
            examMainId: this.queInfo.examMainId,
            isFromWrong: this.isFromWrong,
            realReviseNum: this.realReviseNum,
            curDate: this.curDate,
            workType:this.workType,
            clockInId:this.clockInId,
            curHwId: curHwId,
            ttId: this.ttId, //营期ID
            tpId: this.tpId, //环节ID
            tlId: this.tlId, //课时ID
          }
        });
      });
    },

    //点击选择答案
    clickChooseOption(chooseOption) {
      if (this.queInfo.type == 1 || this.queInfo.type == 4) {
        //单选题
        this.resultAswList = [];
        this.resultAswList.push(chooseOption)
      } else {
        //多选题
        if (this.resultAswList.includes(chooseOption)) {
          let arr = this.resultAswList.filter(item => {
            return item != chooseOption;
          });
          this.resultAswList = arr;
        } else {
          this.resultAswList.push(chooseOption);
        }
      }
      this.resultAswList.sort();
    },

    //获取作业本信息
    getHomeWorkDatail() {
      utilJs.getMethod(
        global.apiurl + "signCard/homeworkDetail/" + curHwId,
        res => {
          this.homeWorkInfo = res;
          clearInterval(testTimeCon);
          testTimeTmp = 0;
          this.testTime = '';
          testTimeCon = setInterval(() => {
            testTimeTmp++;
            this.testTime = this.timeTmpToStr(testTimeTmp * 1000);
          }, 1000);
        }
      );
    },
    // 时间差转成具体时间*天*时*分*秒
    timeTmpToStr(timeTmp) {
      const ONE_DAY_TIMESTAMP = 24 * 60 * 60 * 1000;
      const ONE_HOUR_TIMESTAMP = 60 * 60 * 1000;
      const ONE_MINUTE_TIMESTAMP = 60 * 1000;
      const ONE_SECONDS_TIMESTAMP = 1000;

      //获取天数
      let dayNum = Math.floor(timeTmp / ONE_DAY_TIMESTAMP);
      let hourNum = Math.floor((timeTmp - dayNum * ONE_DAY_TIMESTAMP) / ONE_HOUR_TIMESTAMP);
      let minuteNum = Math.floor((timeTmp - dayNum * ONE_DAY_TIMESTAMP - hourNum * ONE_HOUR_TIMESTAMP) / ONE_MINUTE_TIMESTAMP);
      let secondsNum = Math.floor((timeTmp - dayNum * ONE_DAY_TIMESTAMP - hourNum * ONE_HOUR_TIMESTAMP - minuteNum * ONE_MINUTE_TIMESTAMP) / ONE_SECONDS_TIMESTAMP);
      let returnStr = '';
      if (dayNum > 0) {
        returnStr = `${dayNum}天${hourNum}时${minuteNum}分${secondsNum}秒`;
      } else if (hourNum > 0) {
        returnStr = `${hourNum}时${minuteNum}分${secondsNum}秒`;
      } else if (minuteNum > 0) {
        returnStr = `${minuteNum}分${secondsNum}秒`;
      } else if (secondsNum > 0) {
        returnStr = `${secondsNum}秒`;
      }
      return returnStr;
    },

    //获取选择题信息
    getChooseDatail() {
      if (isClicking) {
        return;
      }
      isClicking = true;
      //2 订正 3 重测 1正常
      let type = this.isRevise ? 2 : isReText ? 3 : 1;
      utilJs.getMethod(`${global.apiurl}signCard/questionShow/${curHwId}?number=${this.curNum}&type=${type}&isFromWrong=${this.isFromWrong ? '1' : '0'}&day=${this.curDate}&examMainId=${examMainId}`,
        res => {
          isClicking = false;
          this.$loading.hide();
          this.queInfo = res;
          this.tutorPhone = res.hasSetPhone;
          this.questionId = res.questionId; //保存该题questionId获取下一题时提交
          this.enableShow = res.enableShow
          if (isReText) {
            //如果是重测，则获取已回答的题目里的答案
            let answerIndex = myRetextAswerList.findIndex(item => {
              return item.questionId == this.queInfo.questionId;
            });
            if (answerIndex > -1) {
              if (this.queInfo.type == 5) {
                let userAnswer = myRetextAswerList[answerIndex].userAnswer ? JSON.parse(myRetextAswerList[answerIndex].userAnswer) : [];
                for (let i = 0; i < userAnswer.length; i++) {
                  this.$nextTick(() => {
                    document.querySelectorAll('.input-answer')[i].value = userAnswer[i];
                  });
                }
              } else {
                this.resultAswList = myRetextAswerList[answerIndex].userAnswer.split('') || [];
              }
            } else {
              this.resultAswList = [];
            }
          } else {
            if (this.queInfo.type == 5) {
              let userAnswer = res.userAnswer ? JSON.parse(res.userAnswer) : [];
              for (let i = 0; i < userAnswer.length; i++) {
                this.$nextTick(() => {
                  document.querySelectorAll('.input-answer')[i].value = userAnswer[i];
                });
              }
            } else {
              this.resultAswList = res.userAnswer == 0 ? [] : res.userAnswer.split('') || [];
            }
          }
        }, failRes => {
          this.$loading.hide();
          isClicking = false;
        }
      );
    },

    initData() {
      this.homeWorkInfo = {};
      this.queInfo = {};
      this.resultAswList = [];
      myRetextAswerList = [];
      isClicking = false;
      this.answerText = '';
      this.tutorPhone = '';
      this.showDesc = false;
      this.showVideo = false;
      this.realReviseNum = -1;
      examMainId = this.$route.query.examMainId || -1;
    },
    //分享
    wechatShare: function () {
      let title = window.localStorage.getItem("companyName");
      let shareImg = window.localStorage.getItem("shareLogo");
      let shareDesc = window.localStorage.getItem("shareDesc");
      let shareUrl = `${window.location.href.split("#")[0]}#${this.$route.path}?refereeId=${localStorage.getItem("userId")}`
      let shareIndexData = {
        shareUrl,
        title,
        shareImg,
        shareDesc,
      };
      let shareData = localStorage.getItem("homeWorkShare") ? JSON.parse(localStorage.getItem("homeWorkShare")) : shareIndexData;
      utilJs.wechatConfig(
        shareData.shareUrl,
        shareData.title,
        shareData.shareImg,
        shareData.shareDesc,
        function () { },
        true
      );
    },
    //手机端分享
    appShare: function () {
      let title = window.localStorage.getItem("companyName");
      let shareImg = window.localStorage.getItem("shareLogo");
      let shareDesc = window.localStorage.getItem("shareDesc");
      let shareUrl = `${window.location.href.split("#")[0]}#${this.$route.path}?refereeId=${localStorage.getItem("userId")}`
      let shareIndexData = {
        shareUrl,
        title,
        shareImg,
        shareDesc,
      };
      let shareData = localStorage.getItem("homeWorkShare") ? JSON.parse(localStorage.getItem("homeWorkShare")) : shareIndexData;
      utilJs.appShareTrue(
        shareData.title,
        shareData.shareImg,
        shareData.shareUrl,
        shareData.shareDesc
      );
    }
  },
  activated() {
    setDocumentTitle("发表日记"); // eslint-disable-line
    curHwId = this.$route.query.curHwId;
    isReText = this.$route.query.isReText || '';
    this.isFromWrong = this.$route.query.isFromWrong || '';
    this.isRevise = this.$route.query.isRevise || 0;
    this.realReviseNum = -1;
    this.curNum = this.$route.query.curNum;
    this.ttId = this.$route.query.ttId || '';
    this.tpId = this.$route.query.tpId || '';
    this.tlId = this.$route.query.tlId || '';
    this.ckFrom = this.$route.query.ckFrom || '';
    this.curDate = this.$route.query.curDate || '';
    this.workType = this.$route.query.workType || '';
    this.clockInId = this.$route.query.clockId || '';
    this.questionId = '';
    this.currentVideoObj = {}
    this.isDisCheat = 0
    // window.localStorage.removeItem('homeWorkResultArr');
    this.initData();
    this.getHomeWorkDatail();
    this.getBaseConfig()
    this.getChooseDatail();
    this.wechatShare();
  },
  deactivated() {
    clearInterval(testTimeCon);
  }
};
</script>

<style scoped>
.closeBig >>> p > img,
.closeBig >>> section > img,
.closeBig >>> div > img,
.closeBig >>> img {
  pointer-events: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -webkit-user-select: none;
  -o-user-select: none;
  user-select: none;
}
.aCloseBig >>> p > a > img,
.aCloseBig >>> section > a > img,
.aCloseBig >>> div > a > img {
  pointer-events: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -webkit-user-select: none;
  -o-user-select: none;
  user-select: none;
}
</style>
